package com.wanli.graalvmdemo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class HomeController {
    @Autowired
    private ApplicationContext applicationContext;

    @GetMapping("/test")
    public String test() {
        Resource resource = applicationContext.getResource("classpath:/templates/loginpage.html");
        System.out.println("File exists? " + resource.exists());
        return "loginpage";
    }

    @GetMapping("/home")
    public String home() {
        return "index";
    }

    @GetMapping("/logout")
    public String logout() {
        return "logout";
    }

    @GetMapping("/register")
    public String register() {
        return "register";
    }
}
